<template>
  <div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [
        {
          name: 'invoiceMatch',
          meta: { title: '销项管理', icon: 'feather-alt' },
          children: [
            {
              name: 'invocieLmageIndex2',
              meta: {
                title: '发票采集',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
              children: [
                {
                  name: 'invocieLmageIndex2',
                  meta: {
                    title: '发票采集',
                    noKeepAlive: false,
                    icon: 'feather-alt',
                  }
                },
                {
                  name: 'orderMatch2',
                  meta: {
                    title: '发票匹配',
                    noKeepAlive: false,
                    icon: 'feather-alt',
                  }
                },
                {
                  name: 'CheckCertification',
                  meta: {
                    title: '发票勾选认证',
                    noKeepAlive: false,
                    icon: 'feather-alt',
                  },
                },
                {
                  name: 'certificationStat',
                  meta: {
                    title: '认证结果查询',
                    noKeepAlive: false,
                    icon: 'feather-alt',
                  },
                },
                {
                  name: 'CheckLog',
                  meta: {
                    title: '报表统计',
                    noKeepAlive: false,
                    icon: 'feather-alt',
                  },
                }
                ,{
                  name: 'CheckLog',
                  meta: {
                    title: '发票查验日志',
                    noKeepAlive: false,
                    icon: 'feather-alt',
                  },
                },
              ]
            },
            {
              name: 'orderMatch2',
              meta: {
                title: '发票匹配',
                noKeepAlive: false,
                icon: 'feather-alt',
              }
            },
            {
              name: 'CheckCertification',
              meta: {
                title: '发票勾选认证',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            },
            {
              name: 'certificationStat',
              meta: {
                title: '认证结果查询',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            },
            {
              name: 'CheckLog',
              meta: {
                title: '报表统计',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            }
            ,{
              name: 'CheckLog',
              meta: {
                title: '发票查验日志',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            },
          ]
        },
        {
          name: 'invoiceMatch',
          meta: { title: '进项管理', icon: 'feather-alt' },
          children: [
            {
              name: 'CheckCertification',
              meta: {
                title: '发票勾选认证',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            },
            {
              name: 'certificationStat',
              meta: {
                title: '认证结果查询',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            },
            {
              name: 'CheckLog',
              meta: {
                title: '报表统计',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            }
            ,{
              name: 'CheckLog',
              meta: {
                title: '发票查验日志',
                noKeepAlive: false,
                icon: 'feather-alt',
              },
            },
          ]
        },
      ]
    }
  },
  created() {
    this.harr(this.arr)
  },
  methods: {
    harr(arr) {
      let newArr = []
      arr.forEach((item, index) => {
        if(item.children) {
          newArr.push({lable: item.meta.title, value: item.name, children: []})
          item.children.forEach((it, i) => {
            if(it.children) {
              newArr[index].children.push({lable: it.meta.title, value: it.name, children: []})
              it.children.forEach(an => {
                // console.log(newArr[index].children, an);
                newArr[index].children[i].children.push({lable: an.meta.title, value: an.name})
              })
            } else {
              newArr[index].children.push({lable: it.meta.title, value: it.name})
            }
          })
        } else {
          newArr.push({lable: item.meta.title, value: item.name})
        }
      })
      console.log('newArr', newArr);
    },
  }
}
</script>

<style>

</style>